package com.test;

import java.io.IOException;
import java.io.Reader;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import com.bean.Tuser;
import com.dao.TuserDao;

public class UpdateTuser {
	public static void main(String[] args) {
		String resource="mybatis-config.xml";
		Reader reader=null;
		try {
			reader=Resources.getResourceAsReader(resource);
			SqlSessionFactory sessionFactory=new SqlSessionFactoryBuilder().build(reader);
			SqlSession session=sessionFactory.openSession();
			TuserDao tuserdao=session.getMapper(TuserDao.class);
			Tuser t=new Tuser();
			t.setUserid(3);
			t.setUseraccount("cba");
			t.setUserpass("321");
			tuserdao.updateTuser(t);
			session.commit();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}
